import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param times int整型二维数组 
     * @return int整型
     */
    public int AttendMeetings (int[][] times) {
        // write code here
        Arrays.sort(times, (o1 ,o2) -> o1[1] - o2[1]);
        int count = 0;
        int cur = 0;
        for(int i = 0; i < times.length; i++){
            if(cur <= times[i][0]){
                count++;
                cur = times[i][1];
            }
        }
        return count;
    }
}